<template>
  <div class="pdf">
    <div id="export-pdf">
      <el-descriptions title="User Info" border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
      <el-descriptions border>
        <el-descriptions-item label="Username"> kooriookami </el-descriptions-item>
        <el-descriptions-item label="Telephone"> 18100000000 </el-descriptions-item>
        <el-descriptions-item label="Place"> Suzhou </el-descriptions-item>
        <el-descriptions-item label="Remarks">
          <el-tag size="small"> School </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="Address"> No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province </el-descriptions-item>
      </el-descriptions>
    </div>
    <el-button @click="handleExportPdf"> 导出PDF </el-button>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive } from 'vue'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
const handleExportPdf = () => {
    const element = document.getElementById('export-pdf') as HTMLElement
    html2canvas(element).then(canvas => {
        var contentWidth = canvas.width
        var contentHeight = canvas.height
        console.log(contentWidth)
        console.log(contentHeight)

        //一页pdf显示html页面生成的canvas高度;
        var pageHeight = (contentWidth / 592.28) * 841.89
        console.log(pageHeight)
        //未生成pdf的html页面高度
        var leftHeight = contentHeight
        //页面偏移
        var position = 0
        //a4纸的尺寸[595.28,841.89]，html页面生成的canvas在pdf中图片的宽高
        var imgWidth = 595.28
        var imgHeight = (592.28 / contentWidth) * contentHeight
        var pageData = canvas.toDataURL('image/jpeg', 1.0)
        var pdf = new jsPDF('p', 'pt', 'a4')
        //有两个高度需要区分，一个是html页面的实际高度，和生成pdf的页面高度(841.89)
        //当内容未超过pdf一页显示的范围，无需分页
        if (leftHeight < pageHeight) {
            pdf.addImage(pageData, 'JPEG', -20, -20, imgWidth, imgHeight)
        } else {
            while (leftHeight > 0) {
                pdf.addImage(pageData, 'JPEG', 10, position, imgWidth, imgHeight)
                leftHeight -= pageHeight
                position -= 841.89
                position -= 10
                //避免添加空白页
                if (leftHeight > 0) {
                    pdf.addPage()
                }
            }
        }
        pdf.save('测试PDF' + '.pdf')
    })
}
</script>

<style lang="less" scoped>
.pdf {
}
</style>
